<template>
  <div class="web-bank">
    <app-return></app-return>
    <div class="card-box" :style="`${strColor}`">
      <h3>银行名称</h3>
      <p>类型</p>
      <p>**** **** **** ****</p>
      <p>
        <span>持卡人</span><span><i>**</i>支行</span>
      </p>
    </div>
    <div class="color-list">
      <ul>
        <li @click="toggleColor(0)" :class="index == 0 ? 'active' : ''">
          <span v-if="index == 0 ? true : false">✔</span>
        </li>
        <li @click="toggleColor(1)" :class="index == 1 ? 'active' : ''">
          <span v-if="index == 1 ? true : false">✔</span>
        </li>
        <li @click="toggleColor(2)" :class="index == 2 ? 'active' : ''">
          <span v-if="index == 2 ? true : false">✔</span>
        </li>
        <li @click="toggleColor(3)" :class="index == 3 ? 'active' : ''">
          <span v-if="index == 3 ? true : false">✔</span>
        </li>
        <li @click="toggleColor(4)" :class="index == 4 ? 'active' : ''">
          <span v-if="index == 4 ? true : false">✔</span>
        </li>
        <li @click="toggleColor(5)" :class="index == 5 ? 'active' : ''">
          <span v-if="index == 5 ? true : false">✔</span>
        </li>
        <li @click="toggleColor(6)" :class="index == 6 ? 'active' : ''">
          <span v-if="index == 6 ? true : false">✔</span>
        </li>
        <li @click="toggleColor(7)" :class="index == 7 ? 'active' : ''">
          <span v-if="index == 7 ? true : false">✔</span>
        </li>
        <li @click="toggleColor(8)" :class="index == 8 ? 'active' : ''">
          <span v-if="index == 8 ? true : false">✔</span>
        </li>
      </ul>
    </div>
    <div class="form">
      <div>
        <input type="text" placeholder="卡号（必填）" />
      </div>
      <div>
        <input type="text" placeholder="银行名称" />
        <input type="text" placeholder="开户行" />
      </div>
      <div>
        <input type="text" placeholder="银行卡类型" />
        <input type="text" placeholder="持卡人姓名" />
      </div>
    </div>
  </div>
</template>

<script>
import AppReturn from "@/components/app-return.vue";
export default {
  name: "Bank",
  components: {
    AppReturn,
  },
  data() {
    return {
      index: 0,
      strColor: "backgroundColor:burlywood",
    };
  },
  methods: {
    toggleColor(i) {
      this.index = i;
      if (this.index == 0) {
        this.strColor = "backgroundColor:burlywood";
      } else if (this.index == 1) {
        this.strColor = "backgroundColor:darkgoldenrod";
      } else if (this.index == 2) {
        this.strColor = "backgroundColor:darkseagreen";
      } else if (this.index == 3) {
        this.strColor = "backgroundColor:deeppink";
      } else if (this.index == 4) {
        this.strColor = "backgroundColor: darkorange";
      } else if (this.index == 5) {
        this.strColor = "backgroundColor: dodgerblue";
      } else if (this.index == 6) {
        this.strColor = "backgroundColor: darksalmon";
      } else if (this.index == 7) {
        this.strColor = "backgroundColor: green";
      } else if (this.index == 8) {
        this.strColor = "backgroundColor: blue";
      }
    },
  },
};
</script>

<style lang="less" scoped>
.web-bank {
  padding: 60px 15px 0;
  box-sizing: border-box;
  .card-box {
    width: 100%;
    background-color: burlywood;
    border-radius: 15px;
    padding: 15px 15px;
    box-sizing: border-box;
    color: #303030;
    margin-bottom: 20px;
    h3 {
      font-size: 16px;
      margin-bottom: 5px;
    }
    p {
      font-size: 12px;
      &:nth-of-type(2) {
        text-align: center;
        margin: 20px 0;
      }
      &:nth-of-type(3) {
        display: flex;
        justify-content: space-between;
      }
    }
  }
  .color-list {
    width: 100%;
    height: 40px;
    ul {
      width: 100%;
      display: flex;
      justify-content: space-between;
      padding: 0 10px;
      box-sizing: border-box;
      li {
        // flex-grow: 1;
        margin: 0 5px;
        width: 25px;
        height: 25px;
        line-height: 25px;
        text-align: center;
        background-color: burlywood;
        border-radius: 50%;
        border: 1px solid transparent;
        box-sizing: border-box;
        &:nth-of-type(2) {
          background-color: darkgoldenrod;
        }
        &:nth-of-type(3) {
          background-color: darkseagreen;
        }
        &:nth-of-type(4) {
          background-color: deeppink;
        }
        &:nth-of-type(5) {
          background-color: darkorange;
        }
        &:nth-of-type(6) {
          background-color: dodgerblue;
        }
        &:nth-of-type(7) {
          background-color: darksalmon;
        }
        &:nth-of-type(8) {
          background-color: green;
        }
        &:nth-of-type(9) {
          background-color: blue;
        }
        &.active {
          border: 1px solid #000;
          span {
            display: block;
            font-size: 18px;
            color: white;
          }
        }
      }
    }
  }
  .form {
    width: 100%;
    > div {
      width: 335px;
      margin-bottom: 10px;
      input {
        font-size: 13px;
        padding-left: 10px;
        border: 1px solid #ccc;
        box-sizing: border-box;
        width: 100%;
        height: 35px;
        border-radius: 10px;
      }
      &:nth-of-type(2) {
        display: flex;
        justify-content: space-between;
        input {
          width: 160px;
        }
      }
      &:nth-of-type(3) {
        display: flex;
        justify-content: space-between;
        input {
          width: 160px;
        }
      }
    }
  }
}
</style>